const env = process.env.NODE_ENV;

let ip: string;

switch (env) {
  case 'development':
    ip = 'http://82.156.217.14:4000';
    break;
  case 'production':
    // ip = 'https://www.liuzhiwei.xyz:4000';
    ip = 'http://82.156.217.14:4000';
    break;
  default:
    ip = 'http://82.156.217.14:4000';
}

console.log(`-- use proxy, env=${env}, ip=${ip}`);

function serverConfig() {
  return {
    host: '0.0.0.0',
    port: 4000,
    https: true,
    proxy: {
      '/api': {
        target: ip, // 服务端地址
        changeOrigin: true,
      },
    },
  };
}

export default serverConfig;
